<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>OBS Form Upload Demo</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <style>
        .container .row {
            margin-bottom: 10px;
        }
        
        h1 {
            margin-top: 50px;
            margin-bottom: 30px;
        }

        label {
            line-height: 38px;
        }
    </style>
</head>

<body>

    <form action="/" id="uploadForm">
        <div class="container">
            <h1 class="title">OBS Form Upload Demo (Upload By XHR)</h1>

            <div class="row">
                <div class="col-3">
                    <label>File</label>
                </div>
                <div class="col-4">
                    <input class="form-control" name="file" type="file" placeholder="Click and select a file" />
                </div>
            </div>

            <div class="row">
                <div class="col-3">
                    <label>Filename</label>
                </div>
                <div class="col-4">
                    <input class="form-control" name="filename" type="text" placeholder="Filename in OBS Bucket" />
                </div>
            </div>

            <div class="row">
                <div class="col-3">
                </div>
                <div class="col-4">
                    <input class="btn btn-primary" name="submitButton" value="UPLOAD" type="submit" />
                </div>
            </div>
        </div>
    </form>

    <!-- Dependence: axios [https://axios-http.com/], axios for http requst -->
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.js"></script>

    <!-- This demo result will block by cors policy, it will upload successfully, but you will get a cors error in response. -->
    <!-- OBS upload module -->
    <script type="module" src="./modules/index.mjs"></script>
</body>

</html>